#ifndef SELECTIONMANAGER_H
#define SELECTIONMANAGER_H

#include <QObject>

class Element;
class ElementSelector;

class SelectionManager : public QObject
{
    Q_OBJECT

    typedef QList<QPointer<Element> > Selection;
public:
    explicit SelectionManager(QObject *parent = 0);

    void updateSelection();

    void drawSelector() const;
    void drawSelectionMarkers() const;

    void setSelector(QPointer<ElementSelector> selector);

    bool isSelected(QPointer<Element> element) const;
protected:

private:
    bool isAllSelected() const;
    bool isNoneSelected() const;

    QPointer<ElementSelector> m_selector;
    Selection m_selection;
signals:
    void selectionChanged();

public slots:
    void select(QPointer<Element> element);
    void deselect(QPointer<Element> element);
    void selectAll();
    void deselectAll();
    void invertSelection();
};

#endif // SELECTIONMANAGER_H
